using System;

namespace Silvery.Command
{
    public abstract class StandardCommand : IGameCommand
    {
        public string Command { get; protected set; }
        public event CommandEventHandler CommandExecute;
        public virtual void Execute(IGameCommandBox parent,string parameter)
        {
            if (CommandExecute != null)
                CommandExecute(parent,new GameCommandEventArgs() { Extractor = this, Parameter = parameter });
            
        }
        public string Instruction { get; protected set; }
        public override string ToString()
        {
            return Command;
        }

        public int CompareTo(object obj)
        {
            if (obj is IGameCommand)
            {
                IGameCommand other = obj as IGameCommand;
                return this.Command.CompareTo(other.Command);
            }
            else
                throw new ArgumentException("object to compare to is not a IGameCommand object");

        }
    }
}
